//
//  LSZDocumentdetailsCell.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/8/20.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZDocumentdetailsCell.h"


@implementation LSZDocumentdetailsCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewIcon = [[UIImageView alloc]init];
        self.imageViewIcon.frame = CGRectMake(10, 10, 120, 80);
        [self addSubview:self.imageViewIcon];
        
        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.imageViewIcon.frame)+10, CGRectGetMinY(self.imageViewIcon.frame)+5, ScreenWidth-20-CGRectGetMaxX(self.imageViewIcon.frame), 40);
        self.labelTitle.numberOfLines = 2;
        self.labelTitle.textColor = titleColorLSZ;
        self.labelTitle.font = FONT_(16);
        [self addSubview:self.labelTitle];
        
        self.imageViewBrowse = [[UIImageView alloc]init];
        self.imageViewBrowse.image = [UIImage imageNamed:@"浏览"];
        self.imageViewBrowse.frame = CGRectMake(CGRectGetMaxX(self.imageViewIcon.frame)+10, CGRectGetMaxY(self.imageViewIcon.frame)-22-5, 22, 22);
        [self addSubview:self.imageViewBrowse];
        
        self.labelBrowse = [[UILabel alloc]init];
        self.labelBrowse.textColor = lightColor;
        self.labelBrowse.font = FONT_(13);
//        self.labelBrowse.text = @"222";
        self.labelBrowse.frame = CGRectMake(CGRectGetMaxX(self.imageViewBrowse.frame)+5, CGRectGetMinY(self.imageViewBrowse.frame), 30, 22);
        [self addSubview:self.labelBrowse];
 
        self.labelTime = [[UILabel alloc]init];
        self.labelTime.textColor = lightColor;
        self.labelTime.font = FONT_(13);
        self.labelTime.textAlignment = NSTextAlignmentRight;
        self.labelTime.frame = CGRectMake(CGRectGetMaxX(self.labelBrowse.frame)+5, CGRectGetMinY(self.labelBrowse.frame), ScreenWidth-CGRectGetMaxX(self.labelBrowse.frame)-25, 22);
        [self addSubview:self.labelTime];
        
    }
    return self;
}
-(void)setSecondaryInterfaceMg:(LSZSecondaryInterfaceMg *)secondaryInterfaceMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:secondaryInterfaceMg.coverUrl] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = secondaryInterfaceMg.name;
    self.labelBrowse.text = secondaryInterfaceMg.sortIndex;
    self.labelTime.text = [NSString stringWithFormat:@"%@",secondaryInterfaceMg.publishTime];

//    self.labelBrowse.text = secondaryInterfaceMg.times;
//    self.labelCollection.text = [NSString stringWithFormat:@"%@     %@",secondaryInterfaceMg.publish,secondaryInterfaceMg.publishTime];
}
-(void)setArticleDetailsMg:(LSZArticleDetailsMg *)articleDetailsMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:articleDetailsMg.coverUrl] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = articleDetailsMg.name;
    self.labelBrowse.text = articleDetailsMg.times;
    self.labelTime.text = [NSString stringWithFormat:@"%@",articleDetailsMg.publishTime];
}
-(void)setPartyBranchActivitiesMg:(LSZPartyBranchActivitiesMg *)partyBranchActivitiesMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:partyBranchActivitiesMg.coverUrl] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = partyBranchActivitiesMg.content;
    self.labelBrowse.hidden = YES;
    self.imageViewBrowse.hidden = YES;
    self.labelTime.textAlignment = NSTextAlignmentLeft;
    self.labelTime.text = [NSString stringWithFormat:@"%@",partyBranchActivitiesMg.publishTime];
    CGRect rect = self.labelTime.frame;
    rect.origin.x = self.labelTitle.origin.x;
    rect.size.width = self.labelTitle.frame.size.width;
    self.labelTime.frame = rect;
}
-(void)setArticleDetailsModel:(LSZArticleDetailsModel *)articleDetailsModel
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:articleDetailsModel.imageViewStr] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = articleDetailsModel.titleStr;
    self.labelBrowse.hidden = YES;
    self.imageViewBrowse.hidden = YES;
    self.labelTime.textAlignment = NSTextAlignmentLeft;
    self.labelTime.text = [NSString stringWithFormat:@"%@",articleDetailsModel.publishTime];
    CGRect rect = self.labelTime.frame;
    rect.origin.x = self.labelTitle.origin.x;
    rect.size.width = self.labelTitle.frame.size.width;
    self.labelTime.frame = rect;
}
-(void)setIndustryMg:(LSZIndustryMg *)industryMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:industryMg.coverUrl] placeholderImage:[UIImage imageNamed:@"默认"]];
    self.labelTitle.text = industryMg.content;
    self.labelBrowse.hidden = YES;
    self.imageViewBrowse.hidden = YES;
    self.labelTime.textAlignment = NSTextAlignmentLeft;
    self.labelTime.text = [NSString stringWithFormat:@"%@",industryMg.publishTime];
    CGRect rect = self.labelTime.frame;
    rect.origin.x = self.labelTitle.origin.x;
    rect.size.width = self.labelTitle.frame.size.width;
    self.labelTime.frame = rect;
}
-(void)setTertiaryInterfaceMg:(LSZTertiaryInterfaceMg *)tertiaryInterfaceMg
{
    [self.imageViewIcon sd_setImageWithURL:[NSURL URLWithString:tertiaryInterfaceMg.coverUrl] placeholderImage:[UIImage imageNamed:@"默认"]];
    if ([tertiaryInterfaceMg.name isEqualToString:@""]) {
        self.labelTitle.text = tertiaryInterfaceMg.summary;
    }else{
        self.labelTitle.text = tertiaryInterfaceMg.name;
    }
    self.labelBrowse.text = tertiaryInterfaceMg.counts;
    self.labelTime.text = [NSString stringWithFormat:@"%@",tertiaryInterfaceMg.publishTime];
}
@end
